package com.alone.wchat.admin.log.service.impl;

import com.alone.wchat.admin.log.entity.SysLog;
import com.alone.wchat.admin.log.mapper.SysLogMapper;
import com.alone.wchat.admin.log.service.ISysLogService;
import com.alone.wchat.common.utils.PageUtils;
import com.alone.wchat.common.utils.Query;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import net.dreamlu.tool.util.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author werdior
 */
@Service
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements ISysLogService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = (String)params.get("key");

        Page<SysLog> page = this.selectPage(
                new Query<SysLog>(params).getPage(),
                new EntityWrapper<SysLog>().like(StringUtils.isNotBlank(key),"username", key)
        );

        return new PageUtils(page);
    }
}
